diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2025-01-11 13:34:13 -0500 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2025-01-11 13:34:13 -0500 |
| commit | 6d51f8568e337e768505ccfdef916b84dd6eb1b3 (patch) | |
| tree | dec4545ccbe44c8e2baf6e633308359f40ac610a /ui/routes/(app)/ch/[channel]/+page.svelte | |
| parent | d858fc8105cfe6333671426fe0e43302bceace92 (diff) | |
npm run format
Diffstat (limited to 'ui/routes/(app)/ch/[channel]/+page.svelte')
| -rw-r--r-- | ui/routes/(app)/ch/[channel]/+page.svelte | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ui/routes/(app)/ch/[channel]/+page.svelte b/ui/routes/(app)/ch/[channel]/+page.svelte index 8eba709..dbdb507 100644 --- a/ui/routes/(app)/ch/[channel]/+page.svelte +++ b/ui/routes/(app)/ch/[channel]/+page.svelte @@ -18,15 +18,17 @@ const elementTop = elRect.top; const elementBottom = elRect.bottom; - return ((parentTop < elementTop) && (parentBottom > elementBottom)); + return parentTop < elementTop && parentBottom > elementBottom; } function getLastVisibleMessage() { const parentElement = activeChannel; const childElements = parentElement.getElementsByClassName('message'); - const lastInView = Array.from(childElements).reverse().find((el) => { - return inView(parentElement, el); - }); + const lastInView = Array.from(childElements) + .reverse() + .find((el) => { + return inView(parentElement, el); + }); return lastInView; } @@ -50,14 +52,14 @@ }); function handleKeydown(event) { - if (event.key === 'Escape') { + if (event.key === 'Escape') { setLastRead(); // TODO: pass in "last message DT"? } } let lastReadCallback = null; function handleScroll() { - clearTimeout(lastReadCallback); // Fine if lastReadCallback is null still. + clearTimeout(lastReadCallback); // Fine if lastReadCallback is null still. lastReadCallback = setTimeout(setLastRead, 2 * 1000); } </script> |
